package hydrap2p.gui.commands;

import hydrap2p.gui.GUIDataHandler;
import hydrap2p.gui.GUIDownloadListing;
import hydrap2p.gui.SearchObject;
import hydrap2p.gui.SearchPanel;

import java.util.List;

import org.apache.thrift.TException;

public class Cmd_SearchPanel_SubmitSearch implements Command {

	@Override
	public void execute() {
		SearchObject so = SearchPanel.getInstance().compileInputs();
		//List<GUIDownloadListing> gdls = GUIDataHandler.getInstance().generateSearchResults(so);
		
		SearchPanel.getInstance().setSearchID(GUIDataHandler.getInstance().submitSearchQuery(so));
		
		/*
		SearchPanel.getInstance().refreshDetails(gdls);
		
		try {
			SearchPanel.getInstance().setCurrentResults(so);
			GUIDataHandler.getInstance().log(GUIDataHandler.LOG_INFO, "Search Panel", "Search Performed");
		} catch (TException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		//*/
		
		System.out.println(getCommand());
		
	}

	@Override
	public String getCommand() {
		return this.getClass().getSimpleName();
	}

	@Override
	public void unexecute() {
		// TODO Auto-generated method stub

	}

}
